^M is the carriage return character.
Windows text files use a combination of carriage return plus line-feed characters as the end-of-line marker; Unix, Linux, and most other platforms use just the line-feed character. Files created on Windows will therefore have additional ^M characters at the end of every line when viewed in Linux. Likewise, files created in Linux and viewed in Windows will lose all their line-breaks.
Solutions:
1) As has been stated, there are utilities to convert files between the two formats.
2) If you're using FTP to transfer the files, switch it to ASCII mode when you upload or download the files, and the FTP server will convert the line feeds automatically for you.
3) Open the file in an editor that can recognise either format -- in Windows, use Wordpad instead of Notepad. In Linux, I find that KDE's KWrite does the job very nicely, but I'm sure there are others that work just as well.
Hope that helps